package coreSimulation;

/**
 * The baggage class represents an item of passenger's baggage
 * 
 * @author Andrew Stokes
 */
public class Baggage {

	private int width;
	private int height;
	private int depth;
	private double weight;

	/**
	 * 
	 * @param width
	 *            - int representing width of item of passenger's baggage in
	 *            centimeters
	 * @param height
	 *            - int representing height of item of passenger's baggage in
	 *            centimeters
	 * @param depth
	 *            - int representing depth of item of passenger's baggage in
	 *            centimeters
	 * @param weight
	 *            - double representing weight of item of passenger's baggage in
	 *            kilograms
	 */
	public Baggage(int width, int height, int depth, double weight) {

		if (width < 1 || height < 1 || depth < 1 || weight <= 0) {
			throw new IllegalStateException(
					"Invalid parameters supplied to describe baggage. "
							+ "Supply width, height and depth as positive integers, these values represent dimensions in cm."
							+ " Weight should be a positive value representing baggage weight in kg.");
		} else {
			this.width = width;
			this.height = height;
			this.depth = depth;
			this.weight = weight;
		}

	}

	/**
	 * @return int representing the width of an item of passenger's baggage
	 *         measured in centimeters
	 */
	public int getWidth() {
		return width;
	}

	/**
	 * @return int representing the height of an item of passenger's baggage
	 *         measured in centimeters
	 */
	public int getHeight() {
		return height;
	}

	/**
	 * @return int representing the depth of an item of passenger's baggage
	 *         measured in centimeters
	 */
	public int getDepth() {
		return depth;
	}

	/**
	 * @return double representing the weight of an item of passenger's baggage
	 *         measured in kilograms
	 */
	public double getWeight() {
		return weight;
	}

	public String toString() {
		return String.format(
				"Dimensions: %1$-4sx  %2$-4sx  %3$-3scm Weight: %4$-4s kg",
				getWidth(), getHeight(), getDepth(), getWeight());

	}

}